package ControlLayer;
import ModelLayer.*;
import java.util.ArrayList;
//model layer package has to be imported

/**
 * Controller class for the address book
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class AddressCtr
{
    
    //declare instance variables to reference containers
    private Adressebog ab;
    
   
    public AddressCtr(/*---*/)
    {
        ab = Adressebog.getInstance();
    }
    
    //Dummy implementation: after implementing the model layer 
    //objects of class Person are to be returned, not String
     public Person findPerson(int id)
    {
        return ab.findPerson(id);
        
    }
    
    public String getPerson(int id)
    {
        //this method is to search the container for a person
        //with an id-number equal to the parameter id
        //when person is found, the method is to call print-methods in the TUI layer
        
        return "person";
    }
    
    
    public void opretPerson(int id, String navn, String adresse, String postnr, String by, String tlf)
    {   
       Person p = new Person (id, navn, adresse, postnr, by, tlf);
       ab.addPerson (p);
    }
    
    
    
    public void deletePerson(Person p)
    {
        //search for the person and delete the object from the container
        ab.sletPerson(p);
    }
    
    public void updatePerson(int id)
    {
    }
    
    public ArrayList listAllPersons()
    {
          return null;
    }
}
